package at.pervasive.mp3player.actions;

import java.awt.event.ActionEvent;

import javax.swing.Icon;

import at.pervasive.mp3player.Mp3Player;

public class PlayPauseAction extends AbstractMp3PlayerAction
{

	private final Icon playIcon;
	private final Icon pauseIcon;

	public PlayPauseAction(Mp3Player player)
	{
		super(player);

		playIcon = getIcon("play.png");
		pauseIcon = getIcon("pause.png");

		putValue(LARGE_ICON_KEY, player.isPlaying() ? pauseIcon : playIcon);
	}

	@Override
	public void actionPerformed(ActionEvent e)
	{
		player.playPause();
		putValue(LARGE_ICON_KEY, player.isPlaying() ? pauseIcon : playIcon);
	}

}
